package com.winz.cultureapp.activity;

import android.content.Intent;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.winz.cultureapp.R;
import com.winz.cultureapp.base.BaseAppCompatActivity;
import com.winz.cultureapp.constants.Constants;
import com.winz.cultureapp.entity.RecordListBean;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 管理员 -- 场馆订单详情
 */
public class AdminStadiumDesActivity extends BaseAppCompatActivity {
    @BindView(R.id.tv_top_title)
    TextView mTv_top_title;
    @BindView(R.id.tv_no)
    TextView mTv_no;
    @BindView(R.id.tv_order_time)
    TextView mTv_order_time;
    @BindView(R.id.iv_pic)
    ImageView mIv_pic;
    @BindView(R.id.tv_price)
    TextView mTv_price;
    @BindView(R.id.tv_title)
    TextView mTv_title;
    @BindView(R.id.tv_location)
    TextView mTv_location;
    @BindView(R.id.tv_time)
    TextView mTv_time;
    @BindView(R.id.tv_tell)
    TextView mTv_tell;
    @BindView(R.id.tv_type)
    TextView mTv_type;
    private RecordListBean.DataBean.ListBean mData;

    @Override
    protected int contentView() {
        return R.layout.activity_admin_stadium_des;
    }

    @Override
    protected void initViews() {
        mTv_top_title.setText("订单详情");
    }

    @Override
    protected void loadDatas(Intent intent) {
        if (intent != null){
            if (intent.getExtras() != null){
                mData = (RecordListBean.DataBean.ListBean) intent.getExtras().getSerializable(Constants.KEY.ADMIN.DETAIL);
                mTv_no.setText("订单号：" + mData.unitBookOrder.orderNumber);
                mTv_order_time.setText("订单时间："+mData.unitBookOrder.createTime);
                Glide.with(this)
                        .load(mData.unit.imageUrl)
                        .error(R.drawable.pic_default)
                        .into(mIv_pic);
                mTv_price.setText("￥ " + mData.money);
                mTv_title.setText("场馆：" + mData.unit.unitName);
                mTv_location.setText("地址：" + mData.unit.address);
                mTv_time.setText("时间：" + mData.unitScheduleRecord.scheduleDay + " " + mData.unitScheduleRecord.startTime+" - " + mData.unitScheduleRecord.endTime);
                mTv_tell.setText("联系电话：" + mData.phone);

                mTv_type.setText(mData.useStatus == 0?"未使用":mData.useStatus == 1?"已使用":"已过期");
                mTv_type.setTextColor(getResources().getColor(mData.useStatus == 0?R.color.base_color:mData.useStatus == 1?R.color.dodgerblue:R.color.icon_red));
            }
        }
    }

    @OnClick(R.id.fl_back)
    public void onClick() {
        finish();
    }
}
